/* ===================================
   MOBILE-FIRST CSS FOR HOMEPAGE
   Optimized for mobile devices with 3-column square grid layout
   =================================== */

/* Mobile Media Query - Apply to all mobile devices */
@media (max-width: 768px) {
    
    /* ===== FIX: PREVENT HORIZONTAL OVERFLOW ===== */
    * {
        box-sizing: border-box;
    }
    
    html, body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
        margin: 0;
        padding: 0;
    }
    
    body {
        position: relative;
    }
    
    /* ===== 1. COMPACT NAVBAR (HEADER) ===== */
    .navbar {
        padding: 0;
        width: 100%;
    }
    
    .navbar .container {
        padding: 0.5rem 15px;
        min-height: auto;
        width: 100%;
        max-width: 100%;
    }
    
    .logo img {
        height: 45px;
        width: auto;
        margin-top: 4px;
    }
    
    .hamburger {
        display: flex;
        width: 30px;
    }
    
    .hamburger span {
        width: 22px;
        height: 2.5px;
        margin: 2.5px 0;
    }
    
    .nav-menu {
        position: fixed;
        right: -80%;
        top: 0;
        flex-direction: column;
        background: rgba(0, 0, 0, 0.98);
        width: 80%;
        max-width: 80%;
        height: 100vh;
        text-align: left;
        transition: right 0.3s ease;
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.5);
        padding: 80px 0 2rem 0;
        overflow-y: auto;
        gap: 0;
        z-index: 9999;
    }
    
    .nav-menu.active {
        right: 0;
    }
    
    .nav-menu li {
        padding: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .nav-menu > li > a {
        display: block;
        padding: 1rem 1.5rem;
        font-size: 1rem;
        color: white;
    }
    
    .nav-menu a::after {
        display: none;
    }
    
    /* ===== 2. HERO SECTION ADJUSTMENTS ===== */
    .hero {
        height: 70vh;
        min-height: 500px;
        width: 100%;
        max-width: 100vw;
    }
    
    .hero-backgrounds,
    .hero-bg {
        width: 100%;
        max-width: 100%;
    }
    
    .hero-content {
        padding: 0 15px;
        width: 100%;
        max-width: 100%;
    }
    
    .hero-title {
        font-size: 2rem;
        margin-top: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .reputation-box {
        max-width: 90%;
        padding: 1.2rem;
        margin: 1rem 0;
    }
    
    .reputation-text {
        font-size: 0.85rem;
        line-height: 1.6;
        margin-bottom: 1rem;
    }
    
    .reputation-stats {
        flex-direction: row;
        gap: 0.5rem;
        padding-top: 0.8rem;
    }
    
    .stat-item {
        flex: 1;
    }
    
    .stat-number {
        font-size: 1.3rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    .cta-button {
        padding: 12px 35px;
        font-size: 0.95rem;
    }
    
    .carousel-arrow {
        width: 35px;
        height: 35px;
        font-size: 1.2rem;
    }
    
    .carousel-arrow-left {
        left: 8px;
    }
    
    .carousel-arrow-right {
        right: 8px;
    }
    
    .carousel-dots {
        bottom: 20px;
        gap: 8px;
    }
    
    .carousel-dot {
        width: 8px;
        height: 8px;
    }
    
    .carousel-dot.active {
        width: 24px;
    }
    
    /* ===== 3. SERVICES SECTION - 3 SQUARE BOXES PER ROW ===== */
    .services {
        padding: 50px 0;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }
    
    .section-title {
        font-size: 1.5rem;
        margin-bottom: 0.8rem;
    }
    
    .section-subtitle {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
        margin-top: 1.5rem;
        padding: 0 10px;
        width: 100%;
        max-width: 100%;
    }
    
    .service-card {
        height: 0;
        padding-bottom: 100%; /* Creates 1:1 aspect ratio (square) */
        padding-top: 0;
        position: relative;
        border-radius: 8px;
        min-height: auto;
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        align-items: center;
        width: 100%;
        overflow: hidden;
    }
    
    .service-card h3 {
        position: absolute;
        bottom: 10px;
        left: 0;
        right: 0;
        font-size: 0.75rem;
        padding: 0 5px;
        margin: 0;
        text-align: center;
        line-height: 1.2;
        z-index: 2;
    }
    
    .service-card p {
        display: none; /* Hide descriptions on mobile */
    }
    
    /* FIX: Hide explore button by default, show only when card is clicked/active */
    .explore-btn {
        position: absolute;
        bottom: 35px;
        padding: 6px 15px;
        font-size: 0.7rem;
        opacity: 0;
        transform: translateY(10px);
        transition: all 0.3s ease;
        pointer-events: none;
        z-index: 3;
    }
    
    /* Show explore button when service card is clicked/active */
    .service-card.active .explore-btn {
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }
    
    .service-card::before {
        border-radius: 8px;
    }
    
    .service-card:hover {
        transform: none; /* Disable hover effect on mobile */
    }
    
    /* ===== 4. VIDEO GALLERY - 3 SQUARE BOXES PER ROW ===== */
    .video-gallery {
        padding: 50px 0;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }
    
    .video-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
        margin-top: 1.5rem;
        padding: 0 10px;
        width: 100%;
        max-width: 100%;
    }
    
    .video-item {
        height: 0;
        padding-bottom: 100%; /* Creates 1:1 aspect ratio (square) */
        border-radius: 8px;
        position: relative;
        width: 100%;
    }
    
    .video-item video {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    .video-overlay {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
    
    .play-icon {
        font-size: 2rem;
        width: 45px;
        height: 45px;
        padding-left: 4px;
    }
    
    .video-overlay h3 {
        font-size: 0.7rem;
        bottom: 8px;
        padding: 0 5px;
        line-height: 1.2;
    }
    
    .video-item:hover {
        transform: none; /* Disable hover effect on mobile */
    }
    
    .video-item:hover .play-icon {
        transform: none;
    }
    
    /* ===== 5. IMAGE GALLERY - 3 SQUARE BOXES PER ROW ===== */
    .gallery {
        padding: 50px 0;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
        margin-top: 1.5rem;
        padding: 0 10px;
        width: 100%;
        max-width: 100%;
    }
    
    .gallery-item {
        height: 0;
        padding-bottom: 100%; /* Creates 1:1 aspect ratio (square) */
        border-radius: 8px;
        position: relative;
        background-size: cover;
        background-position: center;
        width: 100%;
    }
    
    .gallery-overlay {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 0.8rem 0.4rem;
        transform: translateY(0); /* Always visible on mobile */
    }
    
    .gallery-overlay h3 {
        font-size: 0.75rem;
        margin-bottom: 0;
        line-height: 1.2;
        text-align: center;
    }
    
    .gallery-overlay p {
        display: none; /* Hide descriptions on mobile */
    }
    
    .gallery-item:hover {
        transform: none; /* Disable hover effect on mobile */
    }
    
    /* ===== 6. TESTIMONIALS SECTION - STABILIZED WITH SIDE ARROWS ===== */
    .testimonials {
        padding: 50px 0;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }
    
    .testimonials-slider {
        max-width: 100%;
        margin: 1.5rem 10px;
        min-height: 280px; /* Fixed height to prevent content jumping */
        position: relative;
        padding: 0 10px;
    }
    
    .testimonial-card {
        padding: 1.5rem;
        min-height: 280px; /* Match slider height */
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    
    .testimonial-text {
        font-size: 0.9rem;
        line-height: 1.6;
        margin-bottom: 1rem;
        flex-grow: 1;
        display: flex;
        align-items: center;
    }
    
    .testimonial-author {
        margin-top: auto;
    }
    
    .testimonial-author h4 {
        font-size: 1rem;
    }
    
    .testimonial-author p {
        font-size: 0.85rem;
    }
    
    /* FIX: Move arrows to sides below the testimonial box */
    .testimonial-arrow {
        width: 45px;
        height: 45px;
        font-size: 1.5rem;
        position: absolute;
        top: auto;
        bottom: -70px; /* Position below testimonial box */
        transform: none;
        background: rgba(255, 255, 255, 0.2);
        backdrop-filter: blur(10px);
    }
    
    .testimonial-arrow:hover {
        background: rgba(255, 255, 255, 0.3);
        transform: scale(1.05);
    }
    
    .testimonial-arrow-left {
        left: 20px;
    }
    
    .testimonial-arrow-right {
        right: 20px;
    }
    
    .testimonial-dots {
        margin-top: 5rem; /* Add space for arrows */
        gap: 8px;
    }
    
    .dot {
        width: 8px;
        height: 8px;
    }
    
    .dot.active {
        width: 24px;
    }
    
    /* ===== 7. FAQ SECTION ===== */
    .faq {
        padding: 50px 0;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }
    
    .faq-container {
        max-width: 100%;
        margin: 1.5rem 10px 0;
    }
    
    .faq-item {
        margin-bottom: 0.8rem;
    }
    
    .faq-question {
        padding: 1rem 1.2rem;
    }
    
    .faq-question h3 {
        font-size: 0.95rem;
        padding-right: 0.8rem;
    }
    
    .faq-icon {
        font-size: 1.3rem;
    }
    
    .faq-answer {
        padding: 0 1.2rem;
    }
    
    .faq-item.active .faq-answer {
        padding: 1rem 1.2rem 1.2rem;
    }
    
    .faq-answer p {
        font-size: 0.85rem;
        line-height: 1.6;
    }
    
    /* ===== 8. CONTACT SECTION ===== */
    .contact {
        padding: 50px 0;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }
    
    .contact-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        margin-top: 1.5rem;
        padding: 0 15px;
    }
    
    .contact-info {
        gap: 1.5rem;
    }
    
    .info-item h3 {
        font-size: 1.1rem;
        margin-bottom: 0.4rem;
    }
    
    .info-item p {
        font-size: 0.9rem;
        line-height: 1.6;
    }
    
    .contact-form {
        gap: 0.8rem;
    }
    
    .contact-form input,
    .contact-form select,
    .contact-form textarea {
        padding: 12px;
        font-size: 0.9rem;
    }
    
    .submit-btn {
        padding: 12px;
        font-size: 1rem;
    }
    
    /* ===== 9. COMPACT FOOTER ===== */
    .footer {
        padding: 1.2rem 0;
    }
    
    .footer .container {
        flex-direction: column;
        gap: 0.8rem;
        padding: 0 15px;
    }
    
    .footer p {
        font-size: 0.75rem;
        line-height: 1.4;
        text-align: center;
    }
    
    .social-links {
        gap: 1rem;
    }
    
    .social-links a {
        font-size: 0.85rem;
    }
    
    /* ===== 10. VIDEO MODAL ADJUSTMENTS ===== */
    .video-modal-content {
        width: 95%;
        padding: 0 10px;
    }
    
    .close-modal {
        top: -40px;
        width: 35px;
        height: 35px;
        font-size: 1.5rem;
    }
    
    .modal-nav-arrow {
        width: 35px;
        height: 35px;
        font-size: 1.5rem;
    }
    
    .modal-arrow-left {
        left: 5px;
    }
    
    .modal-arrow-right {
        right: 5px;
    }
    
    .video-controls {
        padding: 0.8rem;
        gap: 0.4rem;
    }
    
    .control-btn {
        width: 35px;
        height: 35px;
        font-size: 1.1rem;
    }
    
    .video-time {
        font-size: 0.75rem;
        min-width: 70px;
    }
    
    .video-title {
        font-size: 1.1rem;
        margin-top: 0.8rem;
    }
    
    /* ===== 11. DROPDOWN MENU ADJUSTMENTS ===== */
    .dropdown-menu {
        position: static;
        min-width: 100%;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: rgba(255, 255, 255, 0.05);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        border-radius: 0;
        padding: 0;
    }
    
    .dropdown.active .dropdown-menu {
        max-height: 500px;
    }
    
    .dropdown-menu li {
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }
    
    .dropdown-menu li:last-child {
        border-bottom: none;
    }
    
    .dropdown-menu a {
        padding: 0.9rem 2.5rem;
        font-size: 0.9rem;
        color: rgba(255, 255, 255, 0.8);
    }
    
    .dropdown-menu a:hover {
        padding-left: 2.5rem;
        background: rgba(102, 126, 234, 0.3);
        color: white;
    }
    
    /* ===== 12. SUCCESS POPUP ADJUSTMENTS ===== */
    .success-popup-content {
        width: 90%;
        max-width: 350px;
        padding: 2rem 1.5rem;
    }
    
    .success-circle {
        width: 60px;
        height: 60px;
    }
    
    .checkmark {
        font-size: 2rem;
    }
    
    .success-popup-content h3 {
        font-size: 1.4rem;
        margin-bottom: 0.8rem;
    }
    
    .success-popup-content p {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
    }
    
    .close-popup-btn {
        padding: 10px 30px;
        font-size: 0.9rem;
    }
    
    /* ===== 13. GENERAL MOBILE OPTIMIZATIONS ===== */
    body {
        font-size: 14px;
        line-height: 1.5;
    }
    
    .container {
        padding: 0 10px;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }
    
    section {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }
    
    /* Hamburger positioning */
    .hamburger {
        z-index: 10000;
        position: relative;
    }
    
    /* Smooth scrolling behavior */
    html {
        scroll-behavior: smooth;
    }
    
    /* Remove hover effects on touch devices */
    .service-card:hover,
    .gallery-item:hover,
    .video-item:hover {
        transform: none;
    }
    
    /* Optimize touch targets */
    .carousel-arrow,
    .testimonial-arrow,
    .cta-button,
    .explore-btn {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Prevent text selection on interactive elements */
    .carousel-nav-btn,
    .testimonial-arrow,
    .faq-question {
        -webkit-user-select: none;
        user-select: none;
    }
    
    /* Prevent any elements from causing horizontal scroll */
    img {
        max-width: 100%;
        height: auto;
    }
    
    .hero-bg {
        background-attachment: scroll; /* Change from fixed to prevent mobile issues */
    }
}

/* ===== EXTRA SMALL DEVICES (< 375px) ===== */
@media (max-width: 375px) {
    .hero-title {
        font-size: 1.7rem;
    }
    
    .reputation-text {
        font-size: 0.8rem;
    }
    
    .stat-number {
        font-size: 1.1rem;
    }
    
    .stat-label {
        font-size: 0.65rem;
    }
    
    .section-title {
        font-size: 1.3rem;
    }
    
    .section-subtitle {
        font-size: 0.9rem;
    }
    
    .services-grid,
    .video-grid,
    .gallery-grid {
        gap: 0.4rem;
    }
    
    .service-card h3,
    .gallery-overlay h3,
    .video-overlay h3 {
        font-size: 0.7rem;
    }
    
    .explore-btn {
        padding: 5px 12px;
        font-size: 0.65rem;
    }
    
    .play-icon {
        font-size: 1.5rem;
        width: 35px;
        height: 35px;
    }
    
    .testimonial-text {
        font-size: 0.85rem;
    }
    
    .faq-question h3 {
        font-size: 0.9rem;
    }
    
    .faq-answer p {
        font-size: 0.8rem;
    }
}

/* ===== VERY SMALL DEVICES (< 360px) ===== */
@media (max-width: 360px) {
    .logo img {
        height: 40px;
    }
    
    .hero-title {
        font-size: 1.5rem;
    }
    
    .section-title {
        font-size: 1.2rem;
    }
    
    .service-card h3,
    .gallery-overlay h3,
    .video-overlay h3 {
        font-size: 0.65rem;
    }
    
    .explore-btn {
        padding: 4px 10px;
        font-size: 0.6rem;
        bottom: 30px;
    }
}